<!DOCTYPE html>
<html>
<head>
     <title>判断支付页</title>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, minimum-scale=1.0, user-scalable=no" />
     <meta name="format-detection" content="telephone=no"/>
     <meta name="viewport" content="width=320,maximum-scale=1.3,user-scalable=no">
     <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
</head>
<style type="text/css">
  body{
     padding: 30px;
     text-align: center;
  }
  .display{
     width: 100%;
     height: 100px;
     line-height: 100px;
     background: #3385ff;
     border-radius: 15px 15px 0px 0px;
  }
  input{
     width: 50%;
     height: 50px;
     border:0 solid;
     background: #3385ff;
     color: white;
  }
</style>
<body>
    <div class="display">
         <span style="color: white;" class="give">考验友情的时候到了</span>
    </div>
    <div style="border-bottom: 1px solid #666"></div>
    <!-- <input type="hidden" name="openid" value="" id="hide" /> -->
    <input style="border-radius: 0px 0px 0px 15px;" type="button" name="nomoney" value="不愿意" id="nomoney" /><input style="border-radius: 0px 0px 15px 0px;" type="button" name="ismoney" value="去支付" id="ismoney" />
</body>
<script type="text/javascript" src="http://code.jquery.com/jquery-3.2.1.js"></script>
<script type="text/javascript">
     
     // 生成随机支付金额
	   var sum = 1+Math.ceil(Math.random()*100)*0.01;//math.ceil向上舍入
     $(".give").append('愿意给ta'+sum+'元查看高清图片吗？');

     var vgid = '<?php echo $data['fgid'];?>'; 
       
     //不愿意支付
     $("#nomoney").click(function(){
      // alert("000");
         $.ajax({
            url:"http://tt.t.vipds.cn/ispay/pay",//跳转到c->isplay的pay方法
            dataType:"json",
            data:{
               gid1 :'<?php echo $data['fgid'];?>',//？？通过session存储的授权登录id
               money:sum,
               openid:'<?php echo $_SESSION['oid']?>' 
            },
            success:function(data){
              //alert(data);
               if (data.status == 0) {
                    if (vgid) {
                       location.href = "http://tt.t.vipds.cn/ispay?fgid="+vgid;//链接中不应再携带授权登录用户的相关信息
                    }else{
                       location.href = "http://tt.t.vipds.cn/ispay";
                    }
                      
               }
            }
         });
     });
    //愿意支付
     $("#ismoney").click(function(){
          $.ajax({
              url:"http://tt.t.vipds.cn/ispay/pay",
              dataType:"json",
              data:{
                 gid2:'<?php echo $data['fgid'];?>',//？？通过session存储的授权登录id
                 money:sum,
                 openid:'<?php echo $_SESSION['oid']?>'
              },
              success:function(data){
                  if (data.status == 1) { 
                        
                        if (vgid) {
                           location.href = "http://tt.t.vipds.cn/ispay?fgid="+vgid;
                        }else{
                           location.href = "http://tt.t.vipds.cn/ispay";//$data['access_token']和$data['openid']由后台wegetoauth中$list传值
                        }   
                  }
              }
          });
     });
</script>
</html>